package com.lmk.Test;

import com.lmk.utils.ArrayTools;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

public class SortTest {
    @Test
    public void testTime(){
        int[] a=ArrayTools.generateArray(100000,1,1000000);
        long time=System.currentTimeMillis();
        Arrays.sort(a);
        time=System.currentTimeMillis()-time;
        System.out.println("冒泡排序消耗多少时间"+time+"毫秒");

    }

    @Test

    public  void testBubble(){
        int[] a= ArrayTools.generateArray(10,10,100);
        System.out.println(Arrays.toString(a));
        ArrayTools.bubbleSort(a);
         System.out.println(Arrays.toString(a));
        }
        @Test
        public void  testSelected(){
            int[] a= ArrayTools.generateArray(10,10,100);
            System.out.println(Arrays.toString(a));
            ArrayTools.selectedSort(a);
            System.out.println(Arrays.toString(a));
        }
        @Test
        public  void  testInsetSort(){
                int[] array=ArrayTools.generateArray(20 ,10,100);
            System.out.println(Arrays.toString(array));
            ArrayTools.testInsetSort(array);
            System.out.println(Arrays.toString(array));
        }
        @Test
        public void test(){
            int[] array=ArrayTools.generateArray(10,1,20);
            System.out.println(Arrays.toString(array));
            ArrayTools.testInsetSort01(array);
            System.out.println(Arrays.toString(array));
    }


}



